<template>
    <div>
        <p class="header">施工质量评价</p>
        <!-- 施工质量评价 -->
        <el-row>
            <!-- 查询栏 -->
            <el-form :inline="true" :model="searchModel">
                <el-col :sm="8" :md="8" :lg="4" :xl="3">
                    <el-form-item>
                        <el-select v-model="searchModel.block" clearable placeholder="请选择区块">
                            <el-option v-for="item in blockOptions" :key="item" :label="item" :value="item" :disabled="item.disabled">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :sm="8" :md="8" :lg="4" :xl="3">
                    <el-form-item>
                        <!-- <el-input placeholder="请填写井名" v-model="searchModel.wellname" clearable maxlength="20" /> -->
                        <el-autocomplete
                            class="inline-input"
                            v-model="searchModel.wellname"
                            :fetch-suggestions="querySearch"
                            placeholder="请填写井名"
                            :trigger-on-focus="false"
                            @select="handleSelect"
                            clearable
                            />
                    </el-form-item>
                </el-col>
                <el-col :sm="8" :md="8" :lg="4" :xl="3">
                    <el-form-item>
                        <el-select v-model="searchModel.wellcategory" clearable placeholder="请选择井别">
                            <el-option v-for="item in wellcategoryOptions" :key="item" :label="item" :value="item" :disabled="item.disabled">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :sm="4" :md="4" :lg="3" :xl="2">
                    <el-row flex justify="start">
                        <el-col :span="12">
                            <el-form-item>
                                <el-button type="primary" @click="submitSearchModel">查询</el-button>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item>
                                <el-button type="success" @click="submitAddModel">新增</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-col>
            </el-form>
        </el-row>
        <!-- 查询结果表格展示 -->
        <el-row style="width: 100%">
            <el-table
                :data="tableList"
                border
                style="width: 100%; font-size: 10px"
                :max-height="tableHeight"
                :header-row-style="rowStyle"
                :header-cell-style="cellStyle"
                :row-style="rowStyle"
                :cell-style="cellStyle"
                stripe
            >
                <el-table-column
                    header-align="center"
                    align="center"
                    type="index"
                    label="ID" 
                    width="80"/>
                <el-table-column
                    prop="wellname"
                    label="井名"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="block"
                    label="区块"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="wellcategory"
                    label="井别"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="welldepth"
                    label="井深"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="fluiddensity"
                    label="钻井液密度(g/cm3)"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="cementteamno"
                    label="固井队号"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="cementway"
                    label="固井方式"
                    width="120"
                    align="center"/>
                    <el-table-column
                    prop="wellbottomtemp"
                    label="井底温度(℃)"
                    width="120"
                    align="center"/>
                <el-table-column
                    prop="cementengineer"
                    label="固井工程师"
                    width="120"/>
                
                <el-table-column
                    prop="total"
                    label="实际总分"
                    width="120"/>
            </el-table>
            <!-- 显示页数 -->
            <div class="pagination">
                <el-pagination
                    background
                    layout="total, prev, pager, next"
                    :current-page="current"
                    :page-size="pageSize"
                    :total="totalData"
                    @current-change="handlePageChange"
                ></el-pagination>
            </div>
            <!-- 弹出框-查询是否有该井眼 -->
            <el-dialog title="井数据查询" :visible.sync="editVisible_well" width="40%">
                <el-form :model="form_well" ref="form_well" label-width="130px">
                    <!-- <el-col :span="12">
                        <el-form-item label="井名">
                            <el-input v-model="form_well.wellname_find" placeholder="请输入待评价井名" clearable></el-input>
                        </el-form-item>
                    </el-col> -->
                    <el-col :span="2" :offset="2"><div class="sub-title">井名</div></el-col>
                    <el-col :span="10">
                        <el-autocomplete
                            class="inline-input"
                            v-model="form_well.wellname_find"
                            :fetch-suggestions="querySearch"
                            placeholder="请输入待评价井名"
                            :trigger-on-focus="false"
                            @select="handleSelect"
                            clearable
                            />
                    </el-col>
                    <el-col :span="4" :offset="2">
                        <el-button type="primary" @click="submitSearchWell">立即评价</el-button>
                    </el-col>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <!-- <el-button @click="editVisible = false">取 消</el-button>
                    <el-button type="primary" @click="saveNew">确 定</el-button> -->
                </span>
            </el-dialog>
            <!-- 弹出编辑框 -->
            <el-dialog title="固井施工质量评价表" :visible.sync="editVisible" width="90%">
                <el-form :model="form" ref="form" label-width="130px">
                    <!-- 自定义编辑内容样式 -->
                    <el-col :span="8">
                        <el-form-item label="区块">
                            <el-select v-model="form.block" clearable placeholder="请选择区块" style="width: 100%">
                            <el-option v-for="item in blockOptions" :key="item" :label="item" :value="item" :disabled="item.disabled">
                            </el-option>
                        </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="井名">
                            <!-- <el-input v-model="form.wellname"></el-input> -->
                            <el-autocomplete
                                class="inline-input"
                                v-model="form.wellname"
                                :fetch-suggestions="querySearch"
                                placeholder="请输入待评价井名"
                                :trigger-on-focus="false"
                                @select="handleSelect"
                                clearable
                                style="width: 100%"
                                />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="井别">
                            <el-select v-model="form.wellcategory" clearable placeholder="请选择井别" style="width: 100%">
                            <el-option v-for="item in wellcategoryOptions" :key="item" :label="item" :value="item" :disabled="item.disabled">
                            </el-option>
                        </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="井队号">
                            <el-input v-model="form.teamno" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固井队号">
                            <el-input v-model="form.cementteamno" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥车型号">
                            <el-input v-model="form.truck" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="井深(m)">
                            <el-input v-model="form.welldepth" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="钻井液密度(g/cm3)">
                            <el-input v-model="form.fluiddensity" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="井底温度(℃)">
                            <el-input v-model="form.wellbottomtemp" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="钻井液体系">
                            <el-input v-model="form.drillingfluidsystem" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固井方式">
                            <el-input v-model="form.cementway" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固井时间">
                            <!-- <el-input v-model="form.cementdate" clearable></el-input> -->
                            <el-date-picker
                                v-model="form.cementdate"
                                type="date"
                                align="right"
                                value-format="yyyy-MM-dd"
                                style="width: 100%"
                                placeholder="请选择固井时间"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="井段1(m)">
                            <el-input v-model="form.section1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="外径1(mm)">
                            <el-input v-model="form.outsize1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="壁厚1(mm)">
                            <el-input v-model="form.wallthickness1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="钢级1">
                            <el-input v-model="form.steelgrade1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="段重1(KN)">
                            <el-input v-model="form.heavy1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="井段2(m)">
                            <el-input v-model="form.section2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="外径2(mm)">
                            <el-input v-model="form.outsize2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="壁厚2(mm)">
                            <el-input v-model="form.wallthickness2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="钢级2">
                            <el-input v-model="form.steelgrade2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="段重2(KN)">
                            <el-input v-model="form.heavy2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="井段2(m)">
                            <el-input v-model="form.section3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item label="外径3(mm)">
                            <el-input v-model="form.outsize3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="壁厚3(mm)">
                            <el-input v-model="form.wallthickness3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="钢级3">
                            <el-input v-model="form.steelgrade3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="4">
                        <el-form-item label="段重3(KN)">
                            <el-input v-model="form.heavy3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆体系1">
                            <el-input v-model="form.sluryformula1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆密度1">
                            <el-input v-model="form.slurydensity1" clearable placeholder="单位：(g/cm3)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="封固井段1(m)">
                            <el-input v-model="form.cementsection1" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆体系2">
                            <el-input v-model="form.sluryformula2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆密度2">
                            <el-input v-model="form.slurydensity2" clearable placeholder="单位：(g/cm3)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="封固井段2(m)">
                            <el-input v-model="form.cementsection2" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆体系3">
                            <el-input v-model="form.sluryformula3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="水泥浆密度3">
                            <el-input v-model="form.slurydensity3" clearable placeholder="单位：(g/cm3)"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="封固井段3(m)">
                            <el-input v-model="form.cementsection3" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="6">
                    <el-form-item label="项目">
                    </el-form-item>
                </el-col>
                <el-col :span="6">
                    <el-form-item label="技术要求">
                    </el-form-item>
                </el-col>
                <el-col :span="4">
                    <el-form-item label="指标">
                    </el-form-item>
                </el-col>
                <el-col :span="2">
                    <el-form-item label="满分">
                    </el-form-item>
                </el-col>
                <el-col :span="3">
                    <el-form-item label="实际情况">
                    </el-form-item>
                </el-col>
                <el-col :span="3">
                    <el-form-item label="实际得分">
                    </el-form-item>
                </el-col> -->
                    <!-- <el-col :span="4" align="middle">
                    <div class="de">固井施工设计</div>
                </el-col>
                <el-col :span="20" align="middle">
                    <el-row>
                        <el-col :span="10"><div class="de">严格按照固井技术规范进行设计</div></el-col>
                        <el-col :span="6"><div class="de">符合要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">严格按照固井技术管理规定审查签字</div></el-col>
                        <el-col :span="6"><div class="de">符合要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>            
                    </el-row>
                </el-col>
                <el-col :span="4" align="middle">
                    <div class="de">井眼准备</div>
                </el-col>
                <el-col :span="20" align="middle">
                    <el-row>
                        <el-col :span="10"><div class="de">下套管前井眼净化</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">通井</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>            
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">井眼扩大率</div></el-col>
                        <el-col :span="6"><div class="de">不超过10%</div></el-col>
                        <el-col :span="2"><div class="de">4</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>                   
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">井眼轨迹</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>                         
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">固井前不溢不漏、油气上窜速度</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">5</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>             
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">固井前循环</div></el-col>
                        <el-col :span="6"><div class="de">>1.5循环周</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>            
                    </el-row>
                </el-col>
                <el-col :span="4" align="middle">
                    <div class="de">钻井液性能</div>
                </el-col>
                <el-col :span="20" align="middle">
                    <el-row>
                        <el-col :span="10"><div class="de">屈服值</div></el-col>
                        <el-col :span="6"><div class="de">密度≤1.30g/cm3，&lt;5Pa1.30g/cm3&lt;密度≤1.80g/cm3，&lt;8Pa密度&gt;1.80g/cm3，&lt;15Pa</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">塑性黏度</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>            
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">初切/终切</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">3</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>                   
                    </el-row>
                    <el-row>
                        <el-col :span="10"><div class="de">滤失量</div></el-col>
                        <el-col :span="6"><div class="de">符合设计要求</div></el-col>
                        <el-col :span="2"><div class="de">2</div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>
                        <el-col :span="3"><div class="de"></div></el-col>                         
                    </el-row>
                </el-col> -->
                    <el-col :span="24">
                        <template>
                            <el-table :data="tableeditData" :span-method="objectSpanMethod" border style="width: 100%"> 
                                <el-table-column align="center" prop="project" label="项目"> </el-table-column>
                                <el-table-column align="center" prop="technology" label="技术要求"></el-table-column>
                                <el-table-column align="center" prop="index" label="指标"> </el-table-column>
                                <el-table-column align="center" prop="fullmarks" label="满分" width="120"> </el-table-column>
                                <!-- 该部分可编辑 -->
                                <el-table-column align="center" label="实际情况" width="200">
                                    <template slot-scope="scope">
                                        <el-input v-model="scope.row.actualsituation" placeholder="实际情况描述"></el-input>
                                    </template>
                                </el-table-column>
                                <el-table-column align="center" label="实际得分" width="200"> 
                                    <template slot-scope="scope">
                                        <el-input v-model="scope.row.actualscore" placeholder="请输入实际得分"></el-input>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </template>
                    </el-col>
                    <el-col :span="24">
                        &nbsp;&nbsp;
                    </el-col>
                    <el-col :span="8" :offset="16">
                        <el-form-item label="实际总分">
                            <el-input v-model="form.total" clearable placeholder="届时会根据打分自动给出"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="钻井工程师">
                            <el-input v-model="form.drillengineer" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固井工程师">
                            <el-input v-model="form.cementengineer" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="钻井液工程师">
                            <el-input v-model="form.fluidengineer" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="评价时间">
                            <!-- <el-input v-model="form.evaluedate" clearable></el-input> -->
                            <el-date-picker
                                v-model="form.evaluedate"
                                type="date"
                                align="right"
                                value-format="yyyy-MM-dd"
                                style="width: 100%"
                                placeholder="请选择评价时间"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="固井监督">
                            <el-input v-model="form.cementmonitor" clearable></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="钻井监督">
                            <el-input v-model="form.drillmonitor" clearable></el-input>
                        </el-form-item>
                    </el-col>  
                    <el-col :span="24">
                        <el-form-item label="备注:">
                            <el-input v-model="textarea" :disabled="true"></el-input>
                        </el-form-item>
                    </el-col>
                    <!-- 此处还可以添加内容 -->
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="editVisible = false">取 消</el-button>
                    <el-button type="primary" @click="saveNew">提交评价</el-button>
                </span>
            </el-dialog>
        </el-row>
    </div>
</template>

<script>
import {
    ListDataDictByCondition
} from '../../../api/module/dataClassification/data_classification';
import {
    SelectCementQualityeValueByCondition,
    GetWellNamesByWord,
    GetAllWellNames,
    GetWellByWellName,
    CementqualityevalueAdd,
} from '../../../api/module/cementingQuality/ConstructionQualityEvaluation';
export default {
    data() {
        return {
            menuName: this.$route.query.menuName, //页面跳转获取的页面名称
            //查询行的数据
            searchModel: {
                //查询部分默认的绑定值
                block: '',
                wellcategory: '', //井别
                wellname: '',
            },
            //分页条数据
            current: 1,
            pageSize: 15,
            totalData: 0,
            //下拉框字典
            blockOptions: [], //油区
            wellcategoryOptions: [], // 井别
            //表格数据
            tableList: [],
            //弹出框内的数据
            form_well: {
                wellname_find: '',
            },
            //弹出框
            editVisible_well: false, //查询是否有该井
            editVisible: false, //新增评价数据
            //模糊查询了list
            restaurants: [],
            wellnameList: [],
            //新增施工质量评价数据 CementqualityevalueList
            form: {
                cementqualityevalueid: null, //ID
                block: '', //区块
                wellname: '', //井名
                wellcategory: '', //井别
                teamno: '', //井队号
                cementteamno: '', //固井队号
                truck: '', //水泥车型号
                welldepth: null, //井深(m)
                fluiddensity: null, //钻井液密度(g/cm3)
                wellbottomtemp: null, //井底温度(℃)
                drillingfluidsystem: '', //钻井液体系
                cementway: '', //固井方式
                cementdate: '',	//固井时间
                section1: '', //井段1
                section2: '', //井段2
                section3: '', //井段3
                outsize1: null, //外径1
                outsize2: null, //外径2
                outsize3: null, //外径3
                wallthickness1: null, //壁厚1
                wallthickness2: null, //壁厚2
                wallthickness3: null, //壁厚3
                steelgrade1: null, //钢级1
                steelgrade2: null, //钢级2
                steelgrade3: null, //钢级3
                heavy1: null, //段重1
                heavy2: null, //段重2
                heavy3: null, //段重3
                sluryformula1: '', //水泥浆体系1
                sluryformula2: '', //水泥浆体系2
                sluryformula3: '', //水泥浆体系3
                slurydensity1: null, //水泥浆密度1
                slurydensity2: null, //水泥浆密度2
                slurydensity3: null, //水泥浆密度3
                cementsection1: '', //封固井段1
                cementsection2: '', //封固井段2
                cementsection3: '', //封固井段3
                total: null, //实际总分
                drillengineer: '', //钻井工程师
                cementengineer: '', //固井工程师
                fluidengineer: '', //钻井液工程师
                evaluedate: '', //评价时间
                cementmonitor: '', //固井监督
                drillmonitor: '', //钻井监督
                scores: [], //实际得分
                situations: [], //实际情况
            },
            scoreList: [], //分数汇总数组
            situationList: [], //情况汇总数组
            totalscore: 0, //评价总分
            //临时存储查出来的数据
            CementqualityevalueList: {},
            //备注
            textarea: '1. 奖励分值记入总分，超过100分，按100分计。2. 现场有固井监督此表由固井监督牵头填写，五方确认签字；若无固井监督则此表由钻井监督牵头填写，四方确认签字。',
            //编辑数据
            tableeditData: [
                {
                    project: '固井施工设计',
                    technology: '严格按照固井技术规范进行设计',
                    index: '符合要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工设计',
                    technology: '严格按照固井技术管理规定审查签字',
                    index: '符合要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '井眼准备',
                    technology: '下套管前井眼净化',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '井眼准备',
                    technology: '通井',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '井眼准备',
                    technology: '井眼扩大率',
                    index: '不超过10%',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '井眼准备',
                    technology: '井眼轨迹',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '井眼准备',
                    technology: '固井前不溢不漏、油气上窜速度',
                    index: '符合设计要求',
                    fullmarks: 5,
                    actualsituation: '',
                    actualscore: 5
                },
                {
                    project: '井眼准备',
                    technology: '固井前循环',
                    index: '>1.5循环周',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '钻井液性能',
                    technology: '屈服值',
                    index: '密度≤1.30g/cm3，<5Pa，1.30g/cm3<密度≤1.80g/cm3，<8Pa，密度>1.80g/cm3，<15Pa',
                    fullmarks: 3,
                    actualsituation: '',
                    actualscore: 3
                },
                {
                    project: '钻井液性能',
                    technology: '塑性黏度',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '钻井液性能',
                    technology: '初切/终切',
                    index: '符合设计要求',
                    fullmarks: 3,
                    actualsituation: '',
                    actualscore: 3
                },
                {
                    project: '钻井液性能',
                    technology: '滤失量',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '水泥及现场水泥浆试验',
                    technology: '现场水泥配方',
                    index: '符合设计',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '水泥及现场水泥浆试验',
                    technology: '水泥混拌质量',
                    index: '密度及稠化时间检验符合设计',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '水泥及现场水泥浆试验',
                    technology: '水泥浆试验（流动度、相容性、水泥石强度等试验）',
                    index: '符合设计要求',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '下套管、固井准备',
                    technology: '套管厂家技术人员上井指导套管上扣',
                    index: '有',
                    fullmarks: '1(奖励)',
                    actualsituation: '',
                    actualscore: 1
                },
                {
                    project: '下套管、固井准备',
                    technology: '套管扶正器加放',
                    index: '符合设计要求',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '下套管、固井准备',
                    technology: '浆柱设计（含密度、三压稳、前置液紊流接触时间等）',
                    index: '符合设计要求',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '下套管、固井准备',
                    technology: '固井施工设计中有套管居中度、顶替效率模拟计算',
                    index: '套管居中度≥67%、顶替效率≥90%',
                    fullmarks: 8,
                    actualsituation: '',
                    actualscore: 8
                },
                {
                    project: '下套管、固井准备',
                    technology: '电测前、下套管前和固井施工协调会',
                    index: '及时组织',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工',
                    technology: '精细控压压力平衡法固井',
                    index: '是',
                    fullmarks: '1(奖励)',
                    actualsituation: '',
                    actualscore: 1
                },
                {
                    project: '固井施工',
                    technology: '是否配备专职固井监督',
                    index: '是',
                    fullmarks: '1(奖励)',
                    actualsituation: '',
                    actualscore: 1 
                },
                {
                    project: '固井施工',
                    technology: '水泥浆密度波动范围（g/cm3）',
                    index: '密度±0.02',
                    fullmarks: 5,
                    actualsituation: '',
                    actualscore: 5
                },
                {
                    project: '固井施工',
                    technology: '注、替浆量',
                    index: '符合设计要求',
                    fullmarks: 5,
                    actualsituation: '',
                    actualscore: 5
                },
                {
                    project: '固井施工',
                    technology: '注、替浆排量',
                    index: '符合设计要求',
                    fullmarks: 5,
                    actualsituation: '',
                    actualscore: 5
                },
                {
                    project: '固井施工',
                    technology: '井口套压控制',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工',
                    technology: '固井作业程序衔接停止时间',
                    index: '<3min',
                    fullmarks: 3,
                    actualsituation: '',
                    actualscore: 3
                },
                {
                    project: '固井施工',
                    technology: '固井过程水泥浆密度监测与记录间隔',
                    index: '2～3min/点',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工',
                    technology: '活动套管',
                    index: '注替水泥浆过程中，若活动套管则奖励，未活动不扣分',
                    fullmarks: '2(奖励)',
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工',
                    technology: '固井工具失效',
                    index: '浮箍倒返、封隔器密封失效等',
                    fullmarks: '5(扣分)',
                    actualsituation: '',
                    actualscore: 5
                },
                {
                    project: '固井施工',
                    technology: '三参数施工记录曲线',
                    index: '有',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '固井施工',
                    technology: '是否井漏',
                    index: '无',
                    fullmarks: 4,
                    actualsituation: '',
                    actualscore: 4
                },
                {
                    project: '固井施工',
                    technology: '水泥返高',
                    index: '符合设计要求',
                    fullmarks: 3,
                    actualsituation: '',
                    actualscore: 3
                },
                {
                    project: '固井施工',
                    technology: '碰压',
                    index: '是',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '后续作业',
                    technology: '候凝方式',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '后续作业',
                    technology: '候凝期间不进行井下作业，避免邻井',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '后续作业',
                    technology: '试压',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                },
                {
                    project: '后续作业',
                    technology: '探、钻塞',
                    index: '符合设计要求',
                    fullmarks: 2,
                    actualsituation: '',
                    actualscore: 2
                }
            ],
            //提示判断
            alertflag: true,
            //table展示数据（样式）
            tableHeight: this.$route.query.tableHeight,
            rowStyle: { height: '30px' },
            cellStyle: {
                padding: 0
            },
        };
    },
    created() {
        // console.log("menuName: " + this.$route.query.menuName)
        //开始查询表数据
        this.SelectCementQualityeValueByCondition();
        //获取下拉框
        this.ListDataDictByCondition();
        //查询出所有的井名
        this.GetAllWellNames();
    },
    mounted() {
        this.restaurants = this.loadAll();
    },
    methods: {
        //带输入查询
        querySearch(queryString, cb) {
            var restaurants = this.restaurants;
            var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
            // 调用 callback 返回建议列表的数据
            cb(results);
        },
        createFilter(queryString) {
            return (restaurant) => {
            return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
            };
        },
        loadAll() {
            return this.wellnameList
        },
        handleSelect(item) {
            // console.log(item);
        },
        //样式
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            if (columnIndex === 0) {
                if (rowIndex === 0) {
                    return {
                        rowspan: 2,
                        colspan: 1
                    };
                } else if (rowIndex === 2) {
                    return {
                        rowspan: 6,
                        colspan: 1
                    };
                } else if (rowIndex === 8) {
                    return {
                        rowspan: 4,
                        colspan: 1
                    };
                } else if (rowIndex === 12) {
                    return {
                        rowspan: 3,
                        colspan: 1
                    };
                } else if (rowIndex === 15) {
                    return {
                        rowspan: 5,
                        colspan: 1
                    };
                } else if (rowIndex === 20) {
                    return {
                        rowspan: 14,
                        colspan: 1
                    };
                } else if (rowIndex === 34) {
                    return {
                        rowspan: 4,
                        colspan: 1
                    };
                } else {
                    return {
                        rowspan: 0,
                        colspan: 0
                    };
                }
            }
        },
        //获取井别下拉列表
        ListDataDictByCondition() {
            //获取油区
            ListDataDictByCondition('区块').then((res) => {
                // console.log(res.data)
                this.blockOptions = res.data;
            });
            //获取井别
            ListDataDictByCondition('井别').then((res) => {
                // console.log(res.data)
                this.wellcategoryOptions = res.data;
            });
        },
        //查询函数
        SelectCementQualityeValueByCondition() {
            SelectCementQualityeValueByCondition(this.searchModel, this.current, this.pageSize)
            .then((res) => {
                //console.log("res:" + res.data)
                this.tableList = res.data.records
                this.totalData = res.data.total
            })
        },
        //查询出所有的井名
        GetAllWellNames() {
            GetAllWellNames()
            .then((res) => {
                // console.log(res)
                var length = res.data.length
                for(var i = 0; i < length; i++) {
                    var element = { "value": res.data[i], "address": "" }
                    this.wellnameList.push(element)
                }
                // console.log(this.wellnameList)
            })
        },
        //模糊查询是否有该井
        GetWellNamesByWord() {
            GetWellNamesByWord(this.form_well.wellname_find) 
            .then((res) => {
                var length = res.data.length
                for(var i = 0; i < length; i++) {
                    var element = { "value": res.data[i], "address": "" }
                    this.wellnameList.push(element)
                }
                // console.log(this.wellnameList)
            })
        },
        //查询需要评价井的基本信息
        GetWellByWellName() {
            GetWellByWellName(this.form_well.wellname_find) 
            .then((res) => {
                console.log(res)
                if(res.code != '200' || res.data == null) {
                    this.$message.error('该井不存在！');
                } else {
                    //数据处理
                    this.CementqualityevalueList = res.data
                    this.form.block = this.CementqualityevalueList.block
                    this.form.wellname = this.CementqualityevalueList.wellname
                    this.form.wellcategory = this.CementqualityevalueList.wellcategory
                    this.form.welldepth = this.CementqualityevalueList.welldepth1
                    this.form.cementdate = this.CementqualityevalueList.enddrilldate
                    //弹出框切换
                    this.editVisible_well = false
                    this.editVisible = true
                }
            })
        },
        //新增数据（评价井）
        CementqualityevalueAdd() {
            CementqualityevalueAdd(this.form) 
            .then((res) => {
                console.log(res)
                this.$message.success(`新增成功`);
            })
        },
        //点击查询
        submitSearchModel() {
            this.current = 1;
            this.SelectCementQualityeValueByCondition();
            this.$message.success('查询数据成功！');
        },
        // 分页导航
        handlePageChange(page) {
            this.current = page;
            this.SelectCementQualityeValueByCondition();
        },
        //点击新增数据
        submitAddModel() {
            this.editVisible_well = true
            this.form_well.wellname_find = ''
            // this.editVisible = true;
            // this.form = {};
        },
        //点击查询是否有该井
        submitSearchWell() {
            // console.log(this.form_well.wellname_find)
            if(this.form_well.wellname_find == '' || this.form_well.wellname_find == null) {
                this.$message.error('请输入待评价井名！')
            } else {
                //查询是否与该井
                this.GetWellByWellName()
            }
        },
        //保存新增
        saveNew() {
            //得分数据处理 actualsituation
            this.totalscore = 0; //计算总分数
            for(var i = 0;i < this.tableeditData.length; i++) {
                var temp1 = this.tableeditData[i].actualsituation
                var temp2 = this.tableeditData[i].actualscore
                if(temp2 == null || temp2 == '' || temp2 == '0' || temp2 == 0) {
                    temp2 = 0
                }
                // temp2 = parseFloat(temp2)
                temp2 = temp2.toString()
                this.totalscore += parseFloat(temp2)
                this.situationList.push(temp1)
                this.scoreList.push(temp2)
            }
            this.form.total = this.totalscore
            this.form.situations =  this.situationList
            this.form.scores = this.scoreList
            // console.log(this.form)
            //调用函数-新增
            this.CementqualityevalueAdd()
            //弹出框关闭
            this.editVisible = false
            //数据置空
            this.form = {}
            this.situationList = []
            this.scoreList = []
            

            // if (this.form.wellname == null || this.form.wellname == '') {
            //     // this.$message.error(`新增数据包名为空，新增失败！`)
            // } else {
            //     this.$message.success(`新增成功`);
            //     // this.InsertOneWell()
            //     // this.FindWellByCondition() //将展示内容修改
            // }
        },      
    }
};
</script>

<style scoped="scoped">
.header {
   
    color:black;
    margin-bottom: 10px;
    text-align:left;
    font-size: 17px;
    background-color: #eef0f6;
    font-weight: 400;
    letter-spacing: 0px;
    height: 27px;
    padding: 5px 10px;
}
.de {
    font-size: 14px;
    color: #606266;
    height: 35px;
}
.sub-title {
    display: table-cell;
    height: 32px;
    vertical-align: middle;
}
</style>